package com.zcl.generic;

import com.sun.org.apache.bcel.internal.generic.InstructionListObserver;
import org.junit.Test;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

/**
 * @Description:
 * @author: zcl
 * @date: 2022/3/11  14:04
 */
public class GenericTest {

    @Test
    public void test1() {
        Order<Integer, String> integerStringOrder = new Order<>("hhh",13);
        integerStringOrder.setHahaV("hahaV");
        integerStringOrder.setOrderName("ordername");
        integerStringOrder.setOrderT(12);

        Integer[] arr = {1,2,3,4,5};
        List<Integer> integers = integerStringOrder.copyFromArrayToList(arr);
//        System.out.println(integers);

        StudentDAO studentDAO = new StudentDAO();
        studentDAO.selectBatch(2,3,4,21,543);

    }

    @Test
    public void test2(){


        List<Object> list1 = Arrays.asList();
        List<String> list2 = null;
        List<?>list = null;



    }

    public void print(List<?> list){
        Iterator<?> iterator = list.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println(next);
        }
    }

    @Test
    public void test3(){
        //有限制条件的通配符
        List<? extends Person> list1 = null;
        List<? super Person> list2 = null;

        List<Student>list3 = null;
        List<Person>list4 = null;
        List<Object>list5 = null;

        //list1里面只能是Person类以及Person的子类
        list1 = list3;
        list1 = list4;
//        list1 = list5;


        //list2里面只能是Person类以及Person的父类等等
//        list2 = list3;
        list2 = list4;
        list2 = list5;

    }

}
